﻿using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Control_GioHang : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        double tongtien = 0;
           
        DataTable dt= new DataTable();
        dt = (DataTable)Session["GioHang"];
            if (Session["GioHang"]!=null)
            {
                Label4.Text = (dt.Rows.Count).ToString()+" SP";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    tongtien += double.Parse(dt.Rows[i]["ThanhTien"].ToString());
                }
                Label5.Text = tongtien.ToString() + " VND";
            }

            //neu chua dang  nhap ma chon hang 
 
            else
            {
                Label4.Text = "0 SP";
                Label5.Text = "0.0 VND";
            }
    }
          

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
       
            if (Session["GioHang"] != null)
            {
                Response.Redirect("~/TrangChu.aspx?GioHang=GioHang");
            }
          
            else
            {
                Response.Redirect("~/TrangChu.aspx?GioHangRong=GioHangRong");
                //Response.Redirect("~/TrangChu.aspx?GioHangRong=GioHangRong");
            }

       
    }
}